/**
 * https://leetcode.cn/problems/count-numbers-with-unique-digits/submissions/567692713/
 * 357. 统计各位数字都不同的数字个数
 * medium 陈贝纯 2024.09.24
 * 数位dp
 */

class Solution {
public:
    int countNumbersWithUniqueDigits(int n) {
        int sum=1;
        if(n>0)
        sum=10;
        for(int i=2;i<=n;++i){
            int d=9;
            int m=i-1;
            int num=d;
            while(m--){
                num*=d;
                d--;
            }
            cout<<num<<endl;
            sum+=num;
        }
        return sum;
    }
};